package stage1.module3.homework1;

public class Homework1 {
    public static void main(String[] args) {
        String s = "ABCD123!@#$%ab";

        //统计并打印大写字母个数
        String s1 = s.replaceAll("[A-Z]", "");
        System.out.println("大写字母个数为："+ (s.length() - s1.length()));

        //统计并打印小写字母个数
        String s2 = s.replaceAll("[a-z]", "");
        System.out.println("小写字母个数为："+ (s.length() - s2.length()));

        //统计并打印数字个数
        String s3 = s.replaceAll("\\d", "");
        System.out.println("数字个数为："+ (s.length() - s3.length()));

        //统计并打印其他字符个数
        String s4 = s.replaceAll("[A-Za-z0-9]", "");
        System.out.println("其他字符个数：" + s4.length());
    }
}
